package vettore;
public class Vettore {
    public int x;
    public int y;

    public Vettore(){
        this.x=0;
        this.y=0;
    }
    public Vettore(int pX, int pY){
        this.x=pX;
        this.y=pY;
    }
    public Vettore(int pXY){
        this.x=pXY;
        this.y=pXY;
    }
    public double modulo(){
        double modulo;
        if(this.x==0){
            modulo=this.y;
        }else if(this.y==0){
            modulo=this.x;
        }else{
            modulo=Math.sqrt((Math.pow(this.x, 2.0)+Math.pow(this.y, 2.0)));
        }
        return modulo;
    }
    @Override
    public String toString(){
        return this.x+" "+this.y;
    }
    @Override
    public boolean equals(Object t){
        if(t instanceof Vettore){
            Vettore tt=(Vettore) t;
            return tt.x==this.x && tt.y==this.y;
        }
        return false;
    }
}
